package zju.cst.seckill.service;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import zju.cst.seckill.dao.UserDao;
import zju.cst.seckill.domain.User;

@Service
public class UserService {

    @Autowired
    public UserDao userDao;

    public User getById(int id){
        return userDao.getById(id);
    }
    @Transactional
    public  boolean tx(){
        User user=new User();
        user.setId(2);
        user.setName("wbr");
        userDao.insert(user);

        User user1=new User();
        user.setId(1);
        user.setName("test");
        userDao.insert(user1);
        return true;
    }


}
